/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package tools.cryptage;

import java.math.BigInteger;
import tools.Tools;

/**
 *
 * @author coload12
 */
public class TestOTPEngine implements IOTPEngine {
    
    @Override
    public Integer nextOTP (Integer premiere_cle, Integer dernier_mot)
    {
       ICryptage engine = new FacadeSha1();
       String chaine = engine.cryptage(dernier_mot.toString(),"") + "_" + engine.cryptage(premiere_cle.toString(),"");
       byte[] nombre = Tools.toSHA1(chaine.getBytes()).getBytes();
       String szResultat = new BigInteger(nombre).toString().substring(2,10);
       return Integer.parseInt(szResultat);
    }
    

}
